package com.company.demo.factory;

import com.company.demo.strategy.IDeduction;
import com.company.demo.strategy.StrategyEnum;

/**
 * 策略工厂
 */
public class StrategyFactory {

    public static IDeduction getDeduction(StrategyEnum strategyEnum) {
        IDeduction deduction = null;
        try {
            deduction = (IDeduction)Class.forName(strategyEnum.getValue()).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return deduction;
    }
}
